var e = require("../../../utils/function.js"), a = require("../../../api.js"), s = getApp();

Page({
    data: {
        img: e.userImg,
        old_address: "",
        new_address: "",
        order_no: "",
        target_adds: ""
    },
    newAddressInput: function(e) {
        e.detail.value;
        var a = this;
        wx.chooseLocation({
            success: function(e) {
                console.log(e, "2222222222222222"), a.setData({
                    new_address: e.address,
                    loaction: {
                        lat: e.latitude,
                        lng: e.longitude
                    }
                }), console.log(a.data.new_address);
            }
        });
    },
    getComplain: function() {
        var o = this, t = o.data.new_address, r = JSON.stringify(o.data.loaction);
        if (e.regTest(t, "请选择最终目的地")) {
            var d = (o = this).data.order_no;
            s.request({
                url: a.order.change,
                method: "post",
                data: {
                    order_no: o.data.order_no,
                    newaddress: o.data.new_address,
                    target_adds_location: r
                },
                success: function(e) {
                    console.log("修改结果", e), 1 == e.code ? wx.navigateBack({
                        url: "/pages/map/orderGoing/orderGoing?order_no=" + d
                    }) : wx.showToast({
                        title: "订单仅能修改一次",
                        icon: "none"
                    });
                }
            });
        } else e.regTest(t, "请选择最终目的地");
    },
    onLoad: function(e) {
        console.log("员目的", e), this.setData({
            order_no: e.order_no,
            target_adds: e.target_adds
        }), e.uid && s.shareCouponsMessage(e.uid);
    },
    onShareAppMessage: function() {
        return {
            title: s.shareAppMessage().title,
            imageUrl: s.shareAppMessage().imageUrl,
            desc: s.shareAppMessage().desc,
            path: s.shareAppMessage().path
        };
    }
});